################################################################
## MOD Title: Music Online Mod (Media Center) - EM Friendly
## MOD Author: Cf Manager < cf_manager@yahoo.com > (Son Thai)
## MOD Description:	This Mod allows you create the Music Online Page
##			where users can upload, listen, rate and comment on songs.
##			Beside that, users can link URL of the song from
##			the another server without uploading.
##			You will have Admin Panel to take control Music Online Page.
## MOD Version: 2.0.6
## Support: http://cfmanager.net.tf
##			http://cfmanager.gate2vn.net
## Demo:	http://cfmanager.gate2vn.net/music.php
##
## Compatibility:	2.0.4 --> 2.0.10 (I tested on phpBB 2.0.6, 2.0.8 & 2.0.10)
##
## Features:
##	- Fully integrated with phpBB2 backend (DB, session, template, multi languages..)
##	- Powerful and handy AdminCP
##	- Multi-categories
##	- Powerfull and phpBB-like permissions system
##	- ModeratorCP
##	- Upload Quota
##	- Lyrics
##	- Top listen songs (can set number of songs viewed)
##	- Rate system
##	- Comment system
##	- Hotlink prevention (can set allowed domains)
##	- Listen counter
##	- Admin/Moderator song approval
##	- Probably uploadable in PHP Safe Mode
##	- Hide the URL of your songs
##	- Link URL of the song from the other server
##
## Bonus funtions:
##	- Allowed files: MP3, WMA, WMV, WAV, MIDI, MPEG, AVI, AU, SWF, QT, RAM, RM
##	- Download song (Music Download Song Add-on)
##	- Song Image (Music Song Image Add-on)
##	- Search Song (Music Search Song Add-on)
##	- And more... (Plz look for at http://www.phpbbhacks.com)
##
## Requirements:
##	A running phpBB 2.0.x (recommend the lastest version)
##	HTTP File Upload Enabled (this MOD can work with PHP Safe-Mode in some cases)
##	MySQL 3.23.x
##
## Installation Level:	Advanced
## Installation Time:	15 minutes
## Files To Edit:	7
##	viewonline.php
##	admin/index.php
##	includes/constants.php
##	includes/page_header.php
##	language/lang_english/lang_main.php
##	templates/subSilver/overall_header.tpl
##	templates/subSilver/subSilver.cfg
##
## Included Files:	46
##	music.php
##	music_cat.php
##	music_comment.php
##	music_comment_edit.php
##	music_comment_delete.php
##	music_delete.php
##	music_edit.php
##	music_modcp.php
##	music_page.php
##	music_song.php
##	music_rate.php
##	music_upload.php
##	admin/admin_music_cat.php
##	admin/admin_music_config.php
##	admin/admin_music_moderators.php
##	music_mod/music_common.php
##	music_mod/music_constants.php
##	music_mod/music_functions.php
##	language/lang_english/lang_admin_music.php
##	language/lang_english/lang_main_music.php
##	templates/subSilver/music_cat_body.tpl
##	templates/subSilver/music_comment_body.tpl
##	templates/subSilver/music_edit_body.tpl
##	templates/subSilver/music_index_body.tpl
##	templates/subSilver/music_modcp_body.tpl
##	templates/subSilver/music_move_body.tpl
##	templates/subSilver/music_page_body.tpl
##	templates/subSilver/music_rate_body.tpl
##	templates/subSilver/music_upload_body.tpl
##	templates/subSilver/admin/music_auth_body.tpl
##	templates/subSilver/admin/music_cat_body.tpl
##	templates/subSilver/admin/music_cat_delete_body.tpl
##	templates/subSilver/admin/music_cat_new_body.tpl
##	templates/subSilver/admin/music_cat_select_body.tpl
##	templates/subSilver/admin/music_config_body.tpl
##	templates/subSilver/images/icon_mini_music.gif
##	templates/subSilver/images/lang_english/upload_song.gif
##
################################################################
## Author Notes:
## 	If you want to update from previous versions please read the 
##	documentation in update/*.
## 	Plz follow the Installation Instructions as strict as you can.
##	Plz visit my support site to get help if you have trouble and
##	get the latest version as well as more new Mods/Hack for it.
##
## 	Full support for this MOD can be obtained at: http://cfmanager.gate2vn.net
## 	This Mod was tested with the following databases: MySQL
##	At last, DO NOT REMOVE MY COPYRIGHT NOTICE!
################################################################
## This MOD is released under the GPL License.
################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
################################################################
#
#-----[ DIY INSTRUCTIONS ]-----------------------------------------------
# 
 CHMOD 777 music_box/upload.  Require for Unix-like host (you 
 can use your FTP client to do this)

 This Music Online will add 5 tables into your database.

 If Easymod was not able to successfully apply the included SQL 
 queries and update the database in Step 2, then do the following:
 
    Upload music_db_install.php and music_mysql.sql to your phpBB root
 	directory then run music_db_install.php by typing on the browser
 	After that, delete both files immediately

 	If you do not want to run music_db_install.php you can run the SQL
 	queries manually in music_mysql.sql

 	At last, you can run music_db_uninstall.php if you don't want to
  	to use this mod anymore

 	Notes: After completed, remember to delete music_db_install.php and
 	music_db_uninstall.php if you don't want to get the problems!
 
#
#-----[ SQL ]-----------------------------------------------
# 
CREATE TABLE phpbb_music (
	song_id int(11) UNSIGNED NOT NULL auto_increment,
	song_filename varchar(255) NOT NULL,
	song_title varchar(255) NOT NULL,
	song_url varchar(255) NOT NULL,
	song_desc text,
	song_singer varchar(255) NOT NULL,
	song_user_id mediumint(8) NOT NULL,
	song_username varchar(32),
	song_user_ip char(8) NOT NULL DEFAULT '0',
	song_time int(11) UNSIGNED NOT NULL,
	song_cat_id mediumint(8) UNSIGNED NOT NULL DEFAULT '1',
	song_view_count int(11) UNSIGNED NOT NULL DEFAULT '0',
	song_lock tinyint(3) NOT NULL DEFAULT '0',
	song_approval tinyint(3) NOT NULL DEFAULT '1',
	PRIMARY KEY (song_id),
	KEY song_cat_id (song_cat_id),
	KEY song_user_id (song_user_id),
	KEY song_time (song_time));

CREATE TABLE phpbb_music_rate (
	rate_song_id int(11) UNSIGNED NOT NULL,
	rate_user_id mediumint(8) NOT NULL,
	rate_user_ip char(8) NOT NULL,
	rate_point tinyint(3) UNSIGNED NOT NULL,
	KEY rate_song_id (rate_song_id),
	KEY rate_user_id (rate_user_id),
	KEY rate_user_ip (rate_user_ip),
	KEY rate_point (rate_point));

CREATE TABLE phpbb_music_comment (
	comment_id int(11) UNSIGNED NOT NULL auto_increment,
	comment_song_id int(11) UNSIGNED NOT NULL,
	comment_user_id mediumint(8) NOT NULL,
	comment_username varchar(32),
	comment_user_ip char(8) NOT NULL,
	comment_time int(11) UNSIGNED NOT NULL,
	comment_text TEXT,
	comment_edit_time int(11) UNSIGNED,
	comment_edit_count smallint(5) UNSIGNED NOT NULL DEFAULT '0',
	comment_edit_user_id mediumint(8),
	PRIMARY KEY(comment_id),
	KEY comment_song_id (comment_song_id),
	KEY comment_user_id (comment_user_id),
	KEY comment_user_ip (comment_user_ip),
	KEY comment_time (comment_time));

CREATE TABLE phpbb_music_cat (
	cat_id mediumint(8) UNSIGNED NOT NULL auto_increment,
	cat_title varchar(255) NOT NULL,
	cat_desc text,
	cat_order mediumint(8) NOT NULL,
	cat_view_level tinyint(3) NOT NULL DEFAULT '-1',
	cat_upload_level tinyint(3) NOT NULL DEFAULT '0',
	cat_rate_level tinyint(3) NOT NULL DEFAULT '0',
	cat_comment_level tinyint(3) NOT NULL DEFAULT '0',
	cat_edit_level tinyint(3) NOT NULL DEFAULT '0',
	cat_delete_level tinyint(3) NOT NULL DEFAULT '2',
	cat_view_groups varchar(255),
	cat_upload_groups varchar(255),
	cat_rate_groups varchar(255),
	cat_comment_groups varchar(255),
	cat_edit_groups varchar(255),
	cat_delete_groups varchar(255),
	cat_moderator_groups varchar(255),
	cat_approval tinyint(3) NOT NULL DEFAULT '0',
	PRIMARY KEY (cat_id),
	KEY cat_order (cat_order));

CREATE TABLE phpbb_music_config (
	config_name varchar(255) NOT NULL,
	config_value varchar(255) NOT NULL,
	PRIMARY KEY (config_name));

INSERT INTO phpbb_music_config VALUES ('max_songs', '1024');
INSERT INTO phpbb_music_config VALUES ('user_songs_limit', '50');
INSERT INTO phpbb_music_config VALUES ('mod_songs_limit', '250');
INSERT INTO phpbb_music_config VALUES ('max_file_size', '3145728');
INSERT INTO phpbb_music_config VALUES ('rows_per_page', '20');
INSERT INTO phpbb_music_config VALUES ('cols_per_page', '1');
INSERT INTO phpbb_music_config VALUES ('top', '5');
INSERT INTO phpbb_music_config VALUES ('sort_method', 'song_time');
INSERT INTO phpbb_music_config VALUES ('sort_order', 'DESC');
INSERT INTO phpbb_music_config VALUES ('mp3_allowed', '1');
INSERT INTO phpbb_music_config VALUES ('wav_allowed', '1');
INSERT INTO phpbb_music_config VALUES ('wma_allowed', '1');
INSERT INTO phpbb_music_config VALUES ('wmv_allowed', '1');
INSERT INTO phpbb_music_config VALUES ('mid_allowed', '1');
INSERT INTO phpbb_music_config VALUES ('ram_allowed', '1');
INSERT INTO phpbb_music_config VALUES ('au_allowed', '1');
INSERT INTO phpbb_music_config VALUES ('mpeg_allowed', '1');
INSERT INTO phpbb_music_config VALUES ('avi_allowed', '1');
INSERT INTO phpbb_music_config VALUES ('swf_allowed', '1');
INSERT INTO phpbb_music_config VALUES ('qt_allowed', '1');
INSERT INTO phpbb_music_config VALUES ('rm_allowed', '1');
INSERT INTO phpbb_music_config VALUES ('desc_length', '512000');
INSERT INTO phpbb_music_config VALUES ('hotlink_prevent', '0');
INSERT INTO phpbb_music_config VALUES ('hotlink_allowed', 'cfmanager.gate2vn.net');
INSERT INTO phpbb_music_config VALUES ('rate', '1');
INSERT INTO phpbb_music_config VALUES ('rate_scale', '10');
INSERT INTO phpbb_music_config VALUES ('comment', '1');
INSERT INTO phpbb_music_config VALUES ('music_version', '.0.6'); 

#
#-----[ COPY ]--------------------------------------------------
#
copy root/music.php to music.php
copy root/music_cat.php to music_cat.php
copy root/music_comment.php to music_comment.php
copy root/music_comment_delete.php to music_comment_delete.php
copy root/music_comment_edit.php to music_comment_edit.php
copy root/music_delete.php to music_delete.php
copy root/music_edit.php to music_edit.php
copy root/music_modcp.php to music_modcp.php
copy root/music_page.php to music_page.php
copy root/music_rate.php to music_rate.php
copy root/music_song.php to music_song.php
copy root/music_upload.php to music_upload.php
copy root/admin/*.php to admin/*.php
copy root/music_box/*.* to music_box/*.*
copy root/language/lang_english/*.php to language/lang_english/*.php
copy root/templates/subSilver/*.* to templates/subSilver/*.*
copy root/templates/subSilver/admin/*.* to templates/subSilver/admin/*.*
copy root/templates/subSilver/images/*.* to templates/subSilver/images/*.*
copy root/templates/subSilver/images/lang_english/*.* to templates/subSilver/images/lang_english/*.*

#
#-----[ OPEN ]--------------------------------------------------
#
viewonline.php
#
#-----[ FIND ]--------------------------------------------------
#
				case PAGE_FAQ:
					$location = $lang['Viewing_FAQ'];
					$location_url = "faq.$phpEx";
					break;
#
#-----[ AFTER, ADD ]--------------------------------------------
#
				case PAGE_MUSIC:
					$location = $lang['Music'];
					$location_url = "music.$phpEx";
					break;
#
#-----[ OPEN ]--------------------------------------------------
#
admin/index.php
#
#-----[ FIND ]--------------------------------------------------
#
						case PAGE_FAQ:
							$location = $lang['Viewing_FAQ'];
							$location_url = "index.$phpEx?pane=right";
							break;
#
#-----[ AFTER, ADD ]--------------------------------------------
#
						case PAGE_MUSIC:
							$location = $lang['Music'];
							$location_url = "index.$phpEx?pane=right";
							break;
#
#-----[ FIND ]--------------------------------------------------
#
					case PAGE_FAQ:
						$location = $lang['Viewing_FAQ'];
						$location_url = "index.$phpEx?pane=right";
						break;
#
#-----[ AFTER, ADD ]--------------------------------------------
#
					case PAGE_MUSIC:
						$location = $lang['Music'];
						$location_url = "index.$phpEx?pane=right";
						break;
#
#-----[ OPEN ]--------------------------------------------------
#
includes/constants.php
#
#-----[ FIND ]--------------------------------------------------
#
if ( !defined('IN_PHPBB') )
{
	die("Hacking attempt");
}
#
#-----[ AFTER, ADD ]--------------------------------------------
#
// Music Online
include($phpbb_root_path . 'music_box/music_constants.' . $phpEx);
#
#-----[ OPEN ]--------------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]--------------------------------------------------
#
	'U_GROUP_CP' => append_sid('groupcp.'.$phpEx),
#
#-----[ AFTER, ADD ]--------------------------------------------
#
	// Music Online
	'L_MUSIC' => $lang['Music'],
	'U_MUSIC' => append_sid('music.'.$phpEx),
#
#-----[ OPEN ]--------------------------------------------------
#
templates/subSilver/overall_header.tpl
#
#-----[ FIND ]--------------------------------------------------
#
{L_USERGROUPS}</a>&nbsp;
#
#-----[ IN-LINE FIND ]--------------------------------------------------
#
{L_USERGROUPS}</a>&nbsp;
#
#-----[ IN-LINE AFTER, ADD ]--------------------------------------------
#
&nbsp;<a href="{U_MUSIC}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_music.gif" width="12" height="13" border="0" alt="{L_MUSIC}" hspace="3" />{L_MUSIC}</a> &nbsp;
#
#-----[ OPEN ]--------------------------------------------------
#
templates/subSilver/subSilver.cfg
#
#-----[ FIND ]--------------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]-------------------------------------------
#
$images['upload_song'] = "$current_template_images/{LANG}/upload_song.gif";
#
#-----[ OPEN ]--------------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]--------------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]-------------------------------------------
#
//
// Music Online
//
$lang['Music'] = 'Music Online'; // or Media Center
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM